<template>
  <el-dialog
    title="本次复习效果"
    :visible.sync="dialogVisible"
    width="550px">
    <el-row>
      <el-col :span="8">
        <el-button type="danger" plain @click="chooseEffect(-1)">完蛋，想不起来</el-button>
      </el-col>
      <el-col :span="8">
        <el-button type="info" plain @click="chooseEffect(0)">一般，有些犹豫</el-button>
      </el-col>
      <el-col :span="8">
        <el-button type="success" plain @click="chooseEffect(1)">能完全想起来</el-button>
      </el-col>
    </el-row>
    <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
  </el-dialog>
</template>

<script>
import { finish } from '@api/plan.api.fetch'

export default {
  name: 'selectEffect',
  data () {
    return {
      dialogVisible: false,
      // -1代表想不起来，记不清  0代表一般，有些犹豫 1代表 完全想起来
      planId: ''
    }
  },
  methods: {
    init (id) {
      this.dialogVisible = true
      this.planId = id
    },
    chooseEffect (p) {
      finish({ planId: this.planId, point: p }).then(res => {
        this.$message.success('恭喜你完成一次复习')
        this.$emit('refresh')
        this.dialogVisible = false
      })
    }
  }
}
</script>

<style scoped>

</style>
